---
const gql = String.raw;
const response = await fetch(
  'https://swapi-graphql.netlify.app/.netlify/functions/index',
  {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({
      query: gql`
        query getFilm($id: ID!) {
          film(id: $id) {
            title
            releaseDate
          }
        }
      `,
      variables: {
        id: 'ZmlsbXM6MQ==',
      },
    }),
  },
);

const json = await response.json();
const { film } = json.data;
---

<h1>Fetching information about Star Wars: A New Hope</h1>
<h2>Title: {film.title}</h2>
<p>Year: {film.releaseDate}</p>
